<?php

$default_date = last_working_day(strftime('%Y-%m-%d', time()));
$date_param = get_param_value('date_param', 'holding_date_param', $default_date);
$_SESSION['holding_date_param'] = $date_param;

$fund_param = get_param_value('fund_param', 'holding_fund_param', '');
$_SESSION['holding_fund_param'] = $fund_param;

$securities_param = get_param_value('securities_param', 'holding_securities_param', '');
$_SESSION['holding_securities_param'] = $securities_param;

//print_r($securities_param);
//print_r($fund_param);
//print_r($date_param);

$action_url = elgg_get_site_url().'portfolio/holding';
echo "<form method='get' action='$action_url'>";
echo '<p><label>Date:</label><br/>'; 
echo elgg_view('input/datepicker', array(
	'name' => 'date_param',
	'value' => $date_param,
	'style' => 'width:100px',
));
echo '</p><p><label>Fund:</label><br/>'; 
echo elgg_view('input/dropdown', array(
	'name' => 'fund_param',
	'value' => $fund_param,
	'options_values' => get_fund_array(),
));
echo '</p><label>Securities:</label>'; 
echo elgg_view('input/autocomplete_securities', array(
	'name' => 'securities_param',
	'value' => $securities_param,
	'width' => 'auto',
));

echo '<br/>'.elgg_view('input/submit', array(
		'name' => 'search',
		'value' => 'Search',
));

///daniel.lin 2012-8-21
/// for export to excel
echo '<br/><br/>'.elgg_view('input/submit', array(
		'name' => 'export',
		'value' => 'Export to Excel',
));

echo "</form>";

